package com.zhaoguang.car.service.impl;

import com.zhaoguang.car.mapper.CarMapper;
import com.zhaoguang.car.service.CarService;
import com.zhaoguang.car.service.ShopInfoService;
import com.zhaoguang.car.vo.DetailCarVo;
import com.zhaoguang.car.vo.ListCarVo;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarServiceImpl implements CarService {

    @Autowired
    CarMapper carMapper;

    @Autowired
    ShopInfoService shopInfoService;

    @Override
    public List<ListCarVo> findAllCars(int offset, int limit) {
        List<ListCarVo> listCar = carMapper.findAllCars(new RowBounds(offset, limit));

        return listCar;
    }



    @Override
    public List<ListCarVo> homeNewCar() {
        List<ListCarVo> listCar = carMapper.homeNewCar();

        return listCar;
    }

    @Override
    public List<ListCarVo> newCarPage() {
        List<ListCarVo> listCar = carMapper.newCarPage();

        return listCar;
    }

    @Override
    public DetailCarVo findCarById(int carId) {
        //获取车辆详情、该车辆所属于的店家、该车所有图片
        DetailCarVo car = carMapper.findCarById(carId);

        return car;
    }

}
